# 使用官方MySQL镜像
FROM mysql:5.7.24
# 设置root用户的密码
ENV MYSQL_ROOT_PASSWORD=oweurH1SDAA01KJSKJ!
# 设置字符集
ENV LANG=C.UTF-8
# 持久化数据卷，防止容器没有挂载目录时丢失数据
VOLUME /var/lib/mysql
# 修改数据文件夹的位置
RUN echo "[mysqld]" >> /etc/mysql/my.cnf && \
  echo "datadir		= /etc/mysql/data" >> /etc/mysql/my.cnf && \
  echo "log-error	= /var/log/mysql/error.log" >> /etc/mysql/my.cnf && \
  echo "# By default we only accept connections from localhost" >> /etc/mysql/my.cnf && \
  echo "#bind-address	= 127.0.0.1" >> /etc/mysql/my.cnf && \
  echo "# Disabling symbolic-links is recommended to prevent assorted security risks" >> /etc/mysql/my.cnf && \
  echo "symbolic-links=0" >> /etc/mysql/my.cnf
# 启动MySQL服务

EXPOSE 3306
EXPOSE 3307
EXPOSE 33060
EXPOSE 33061